package com.hoas.quickstart.threads.chapter06.chapter06_2_1;

public class MyObject {

    private static MyObject instance;

    private MyObject(){}

     public static MyObject getInstance() {
       if (instance == null) {

           try {
               Thread.sleep(3000);
           } catch (InterruptedException e) {
               e.printStackTrace();
           }

           synchronized (MyObject.class) {
               if (instance == null) {
                   instance = new MyObject();
               }
           }

       }

       return instance;

    }
}
